Skip to content

Remove need for context in Sentry.init for Android #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 16, 2023

Conversation

buenaflor
Copy link
Contributor

Ref #114

Eliminates the need for context in init - context can be passed in through a simple ContextProvider.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 10, 2023

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 61a646d

Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, LGTM!

@BeforeTest
open fun setUp() {
// Set up the provider needed for Sentry.init on Android
val provider = Robolectric.buildContentProvider(ContextProvider::class.java)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know that one, nice!

* This does not allow for overriding the abstract query, insert, update, and delete operations
* of the [ContentProvider].
*/
internal class ContextProvider : ContentProvider() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default proguard rules already exclude any ContentProvider classes from being obfuscated these days, but maybe worth double checking if the name is kept in a release build.

Copy link
Contributor Author

@buenaflor buenaflor Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, it's not obfuscated in the release build

@buenaflor buenaflor merged commit 7db2950 into main Aug 16, 2023
@buenaflor buenaflor deleted the feat/remove-context-from-init branch August 16, 2023 08:17
ArnyminerZ added a commit to FilaMagenta/App that referenced this pull request Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants